// ex7_12_12.cpp
#include <iostream>

struct applicant
{
	char name[30];
	int credit_ratings[3];
};

void display(applicant app[]);
void display_addr(applicant *ap);
int main(void)
{
	applicant ap1[] = {
		{"Ann", {3,2,1}},
	    {"Ben", {9,8,7}}
	};
	display(ap1);
	std::cout << "display transport address:\n";
	display_addr(ap1);
}

void display(applicant app[])
{
	//for (int i = 0; i < sizeof (app]) / sizeof(app[0]); i++)
	for (int i = 0; i < 2; i++)
    {
		std::cout << app[i].name << " ";
		for (int j = 0; j < 3; j++)
		{	
			std::cout << app[i].credit_ratings[j] << ' ';
		}
		std::cout << "\n";
	}
}

void display_addr(applicant *ap)
{
	//for (int i = 0; i < sizeof ap / sizeof(ap[0]); i++)
	for (int i = 0; i < 2; i++)
	{	
		std::cout << ap[i].name << " ";
		for (int j = 0; j < 3; j++)
		{	
			std::cout << ap[i].credit_ratings[j] << ' ';
		}
		std::cout << "\n";
	}
}
